package com.leil;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;

import com.leil.source.UserDefineSink;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SpringBootApplication
@EnableEurekaClient
@EnableBinding(UserDefineSink.class)
public class Application {
	
	@Value("${server.port}")
	private String serverPort;
	
	private static final Logger logger = LoggerFactory.getLogger(Application.class);
	
	@StreamListener(UserDefineSink.INPUT)
	public void loggerSink(String info) {
		logger.info(info + serverPort);
	}

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

}
